﻿/*********************************************************************
 *
 *                             NOTICE
 *               COPYRIGHT (c) 2012 Panoscopix Software, Inc.
 *                UNPUBLISHED - ALL RIGHTS RESERVED
 * 
 *      This program is confidential, proprietary, and a trade
 *   secret of Panoscopix Software, Inc. The receipt or possession of
 *     this program does not convey any rights to reproduce or
 *      disclose its contents, or to manufacture, use, or sell
 *       anything that it may describe, in whole or in part, 
 *   without the specific written consent of Panoscopix Software, Inc.
 *
 * Implements the Results of Commands, which is simply string output.
 * 
 *******************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using FileSystem;

namespace FileSystem.Impl
{
    class SimpleHelpStrategy : ICommandHelpStrategy, IAcionHelpStrategy
    {

        private StringBuilder helpText = new StringBuilder();

        #region ICommandHelpStrategy Members

        public void Visit(ICommandPrototype command)
        {
            helpText.AppendLine(getFormattedString(command.Description.Name ,command.Description.Description));
        }

        #endregion

        #region ICommandHelpStrategy Members

        private string getFormattedString(string name, string description)
        {
            return name.PadRight(30, ' ') + description;
        }
        public string HelpText
        {
            get { return helpText.ToString(); }
        }

        #endregion

        #region IAcionHelpStrategy Members

        public void Visit(IHelpDescription command)
        {
            helpText.AppendLine(getFormattedString(command.Name, command.Description));
        }

        #endregion
    }
}

